﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CApFLEXCableAttributeViewModel
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;


namespace DnProcessSimulateCommands;

public class CApFLEXCableAttributeViewModel : 
  ICApFLEXCableAttributeViewModel,
  ICApCableNameViewModel,
  INotifyPropertyChanged,
  ICApCableExtentDescriptor,
  ICApCableCreationModeStatus,
  ICApCableFrameStatus,
  ICApCableParameterChangeChecker
{
  private bool m_isLicenseOn;
  private string m_name;
  private double m_length;
  private double m_radius;
  private double m_density;
  private double m_youngsModulus;
  private double m_maxTension;
  private double m_maxTwistAngle;
  private double m_minCurvatureRadius;
  private double m_maxContactForce;
  private bool m_isMaxTwistAngleLimited;
  private bool m_isMinCurvatureRadiusLimited;
  private bool m_isMaxContactForceLimited;
  private double m_fulcrumLength;
  private double m_oscillation;
  private TxCableDataResolution m_resolution;
  private List<CApFLEXAttachment> m_attachmentsList;
  private string m_message;
  private CApCableStatusMessageType m_messageType;
  private double m_fulcrumStepSize;
  private double m_lengthStepSize;
  private double m_radiusStepSize;
  private double m_minCurvatureStepSize;
  private bool m_isGenerateEnabled;
  private bool m_isCloseEnabled;
  private bool m_isRemoveAttachmentEnabled;
  private bool m_isAddAttachmentEnabled;
  private bool m_isEditAttachmentEnabled;
  private bool m_isEditStartAttachmentFrameEnabled;
  private bool m_isEditEndAttachmentFrameEnabled;
  private bool m_isParametersExpanded;
  private bool m_isAttachmentExpanded;
  private bool m_isOptimizationExpanded;
  private bool m_isLengthOptimizationActivated;
  private bool m_isRadiusOptimizationActivated;
  private bool m_isYoungsModulusOptimizationActivated;
  private ITxLocatableObject m_startFrame;
  private ITxLocatableObject m_endFrame;
  private ITxObject m_startAttachPartTo;
  private ITxObject m_endAttachPartTo;
  private ITxLocatableObject m_passNearFrame;
  private ITxPointCloudLayer m_optimizationPointCloudLayer;
  private bool m_isEditMode;
  private bool m_isCableEditable;
  private CUiFLEXCreationMode m_creationMode;

  public CApFLEXCableAttributeViewModel()
  {
    this.CableScopeStatus = new CApCableScopeStatus();
    this.FocusedPickableControl = PickableControlFocusStatus.None;
  }

  public ITxCable Cable
  {
    get => this.CableScopeStatus.Cable;
    set => this.CableScopeStatus.Cable = value;
  }

  public ITxLocatableObject StartFrame
  {
    get => this.m_startFrame;
    set
    {
      this.NotifyPropertyWillChange(nameof (StartFrame));
      this.m_startFrame = value;
      this.NotifyPropertyChanged(nameof (StartFrame));
    }
  }

  public ITxObject StartAttachPartTo
  {
    get => this.m_startAttachPartTo;
    set
    {
      this.m_startAttachPartTo = value;
      this.NotifyPropertyChanged(nameof (StartAttachPartTo));
    }
  }

  public ITxLocatableObject EndFrame
  {
    get => this.m_endFrame;
    set
    {
      this.NotifyPropertyWillChange(nameof (EndFrame));
      this.m_endFrame = value;
      this.NotifyPropertyChanged(nameof (EndFrame));
    }
  }

  public ITxObject EndAttachPartTo
  {
    get => this.m_endAttachPartTo;
    set
    {
      this.m_endAttachPartTo = value;
      this.NotifyPropertyChanged(nameof (EndAttachPartTo));
    }
  }

  public ITxLocatableObject PassNearFrame
  {
    get => this.m_passNearFrame;
    set
    {
      this.NotifyPropertyWillChange(nameof (PassNearFrame));
      this.m_passNearFrame = value;
      this.NotifyPropertyChanged(nameof (PassNearFrame));
    }
  }

  public ITxPointCloudLayer OptimizationPointCloudLayer
  {
    get => this.m_optimizationPointCloudLayer;
    set
    {
      this.NotifyPropertyWillChange(nameof (OptimizationPointCloudLayer));
      this.m_optimizationPointCloudLayer = value;
      this.NotifyPropertyChanged(nameof (OptimizationPointCloudLayer));
    }
  }

  public PickableControlFocusStatus FocusedPickableControl { get; set; }

  public bool IsFrameCtrlStartFocused
  {
    get => this.FocusedPickableControl == PickableControlFocusStatus.StartFrame;
  }

  public bool IsFrameCtrlEndFocused
  {
    get => this.FocusedPickableControl == PickableControlFocusStatus.EndFrame;
  }

  public bool IsFrameCtrlPassNearFocused
  {
    get => this.FocusedPickableControl == PickableControlFocusStatus.PassNearFrame;
  }

  public bool IsPointCloudLayerCtrlOptimizationFocused
  {
    get => this.FocusedPickableControl == PickableControlFocusStatus.OptimizationPointCloudLayer;
  }

  public double RetractSystemCurrentMaxRetractedLength { get; set; }

  public string CableName
  {
    get => this.m_name;
    set
    {
      this.m_name = value;
      this.NotifyPropertyChanged(nameof (CableName));
    }
  }

  public double Length
  {
    get => this.m_length;
    set
    {
      this.m_length = value;
      this.NotifyPropertyChanged(nameof (Length));
    }
  }

  public double Radius
  {
    get => this.m_radius;
    set
    {
      this.m_radius = value;
      this.NotifyPropertyChanged(nameof (Radius));
    }
  }

  public double Density
  {
    get => this.m_density;
    set
    {
      this.m_density = value;
      this.NotifyPropertyChanged(nameof (Density));
    }
  }

  public double YoungsModulus
  {
    get => this.m_youngsModulus;
    set
    {
      this.m_youngsModulus = value;
      this.NotifyPropertyChanged(nameof (YoungsModulus));
    }
  }

  public double MaxTension
  {
    get => this.m_maxTension;
    set
    {
      this.m_maxTension = value;
      this.NotifyPropertyChanged(nameof (MaxTension));
    }
  }

  public double MaxTwistAngle
  {
    get => this.m_maxTwistAngle;
    set
    {
      this.m_maxTwistAngle = value;
      this.NotifyPropertyChanged(nameof (MaxTwistAngle));
    }
  }

  public double MinCurvatureRadius
  {
    get => this.m_minCurvatureRadius;
    set
    {
      this.m_minCurvatureRadius = value;
      this.NotifyPropertyChanged(nameof (MinCurvatureRadius));
    }
  }

  public double MaxContactForce
  {
    get => this.m_maxContactForce;
    set
    {
      this.m_maxContactForce = value;
      this.NotifyPropertyChanged(nameof (MaxContactForce));
    }
  }

  public bool IsEditStartAttachmentFrameEnabled
  {
    get => this.m_isEditStartAttachmentFrameEnabled && this.AreEquipmentParametersEnabled;
    set
    {
      this.m_isEditStartAttachmentFrameEnabled = value;
      this.NotifyPropertyChanged(nameof (IsEditStartAttachmentFrameEnabled));
    }
  }

  public bool IsEditEndAttachmentFrameEnabled
  {
    get => this.m_isEditEndAttachmentFrameEnabled && this.AreEquipmentParametersEnabled;
    set
    {
      this.m_isEditEndAttachmentFrameEnabled = value;
      this.NotifyPropertyChanged(nameof (IsEditEndAttachmentFrameEnabled));
    }
  }

  public bool IsMaxTwistAngleLimited
  {
    get => this.m_isMaxTwistAngleLimited;
    set
    {
      this.m_isMaxTwistAngleLimited = value;
      this.NotifyPropertyChanged(nameof (IsMaxTwistAngleLimited));
      this.NotifyPropertyChanged("IsMaxTwistAngleEnabled");
    }
  }

  public bool IsMaxTwistAngleEnabled => this.IsMaxTwistAngleLimited && this.IsCableParameterEnabled;

  public bool IsMinCurvatureRadiusLimited
  {
    get => this.m_isMinCurvatureRadiusLimited;
    set
    {
      this.m_isMinCurvatureRadiusLimited = value;
      this.NotifyPropertyChanged(nameof (IsMinCurvatureRadiusLimited));
      this.NotifyPropertyChanged("IsMinCurvatureRadiusEnabled");
    }
  }

  public bool IsMinCurvatureRadiusEnabled
  {
    get => this.IsMinCurvatureRadiusLimited && this.IsCableParameterEnabled;
  }

  public bool IsMaxContactForceLimited
  {
    get => this.m_isMaxContactForceLimited;
    set
    {
      this.m_isMaxContactForceLimited = value;
      this.NotifyPropertyChanged(nameof (IsMaxContactForceLimited));
      this.NotifyPropertyChanged("IsMaxContactForceEnabled");
    }
  }

  public bool IsMaxContactForceEnabled
  {
    get => this.IsMaxContactForceLimited && this.IsCableParameterEnabled;
  }

  public double FulcrumLength
  {
    get => this.m_fulcrumLength;
    set
    {
      this.m_fulcrumLength = value;
      this.NotifyPropertyChanged(nameof (FulcrumLength));
    }
  }

  public double Oscillation
  {
    get => this.m_oscillation;
    set
    {
      this.m_oscillation = value;
      this.NotifyPropertyChanged(nameof (Oscillation));
    }
  }

  public TxCableDataResolution Resolution
  {
    get => this.m_resolution;
    set
    {
      this.m_resolution = value;
      this.NotifyPropertyChanged(nameof (Resolution));
    }
  }

  public bool IsLengthOptimizationActivated
  {
    get => this.m_isLengthOptimizationActivated;
    set
    {
      if (value == this.m_isLengthOptimizationActivated)
        return;
      this.m_isLengthOptimizationActivated = value;
      this.NotifyPropertyChanged(nameof (IsLengthOptimizationActivated));
    }
  }

  public bool IsRadiusOptimizationActivated
  {
    get => this.m_isRadiusOptimizationActivated;
    set
    {
      if (value == this.m_isRadiusOptimizationActivated)
        return;
      this.m_isRadiusOptimizationActivated = value;
      this.NotifyPropertyChanged(nameof (IsRadiusOptimizationActivated));
    }
  }

  public bool IsYoungsModulusOptimizationActivated
  {
    get => this.m_isYoungsModulusOptimizationActivated;
    set
    {
      if (value == this.m_isYoungsModulusOptimizationActivated)
        return;
      this.m_isYoungsModulusOptimizationActivated = value;
      this.NotifyPropertyChanged(nameof (IsYoungsModulusOptimizationActivated));
    }
  }

  public List<CApFLEXAttachment> AttachmentDataList
  {
    get => this.m_attachmentsList;
    set => this.m_attachmentsList = value;
  }

  public double RadiusStepSize
  {
    get => this.m_radiusStepSize;
    set
    {
      this.m_radiusStepSize = value;
      this.NotifyPropertyChanged(nameof (RadiusStepSize));
    }
  }

  public double LengthStepSize
  {
    get => this.m_lengthStepSize;
    set
    {
      this.m_lengthStepSize = value;
      this.NotifyPropertyChanged(nameof (LengthStepSize));
    }
  }

  public double FulcrumStepSize
  {
    get => this.m_fulcrumStepSize;
    set
    {
      this.m_fulcrumStepSize = value;
      this.NotifyPropertyChanged(nameof (FulcrumStepSize));
    }
  }

  public double MinCurvatureStepSize
  {
    get => this.m_minCurvatureStepSize;
    set
    {
      this.m_minCurvatureStepSize = value;
      this.NotifyPropertyChanged(nameof (MinCurvatureStepSize));
    }
  }

  public CApCableStatusAnalysis CableStatusAnalysis { get; set; }

  public string Message
  {
    get => this.m_message;
    set
    {
      this.m_message = value;
      this.NotifyPropertyChanged(nameof (Message));
    }
  }

  public CApCableStatusMessageType StatusMessageType
  {
    get => this.m_messageType;
    set
    {
      this.m_messageType = value;
      this.NotifyPropertyChanged(nameof (StatusMessageType));
    }
  }

  public bool IsGenerateEnabled
  {
    get => this.m_isGenerateEnabled;
    set
    {
      this.m_isGenerateEnabled = value;
      this.NotifyPropertyChanged(nameof (IsGenerateEnabled));
    }
  }

  public bool IsCloseEnabled
  {
    get => this.m_isCloseEnabled;
    set
    {
      this.m_isCloseEnabled = value;
      this.NotifyPropertyChanged(nameof (IsCloseEnabled));
    }
  }

  public bool IsOptimizeEnabled
  {
    get
    {
      return TxFeatureManager.CheckFeature("CABLE_STIFFNESS_OPTIMIZER") && this.m_optimizationPointCloudLayer != null;
    }
  }

  public bool IsRemoveAttachmentEnabled
  {
    get => this.m_isRemoveAttachmentEnabled && this.AreEquipmentParametersEnabled;
    set
    {
      this.m_isRemoveAttachmentEnabled = value;
      this.NotifyPropertyChanged(nameof (IsRemoveAttachmentEnabled));
      this.NotifyPropertyChanged("AreEquipmentParametersEnabled");
    }
  }

  public bool IsAddAttachmentEnabled
  {
    get => this.m_isAddAttachmentEnabled && this.AreEquipmentParametersEnabled;
    set
    {
      this.m_isAddAttachmentEnabled = value;
      this.NotifyPropertyChanged(nameof (IsAddAttachmentEnabled));
      this.NotifyPropertyChanged("AreEquipmentParametersEnabled");
    }
  }

  public bool IsEditAttachmentEnabled
  {
    get => this.m_isEditAttachmentEnabled;
    set
    {
      this.m_isEditAttachmentEnabled = value;
      this.NotifyPropertyChanged(nameof (IsEditAttachmentEnabled));
    }
  }

  public bool IsEditMode
  {
    get => this.m_isEditMode;
    set
    {
      this.m_isEditMode = value;
      this.NotifyPropertyChanged(nameof (IsEditMode));
      this.NotifyPropertyChanged("AreEquipmentParametersEnabled");
      this.NotifyPropertyChanged("IsCableParameterEnabled");
    }
  }

  public bool IsCableEditable
  {
    get => this.m_isCableEditable;
    set
    {
      this.m_isCableEditable = value;
      this.NotifyPropertyChanged(nameof (IsCableEditable));
      this.NotifyPropertyChanged("IsMinCurvatureRadiusEnabled");
      this.NotifyPropertyChanged("IsMaxTwistAngleEnabled");
      this.NotifyPropertyChanged("IsMaxContactForceEnabled");
      this.NotifyPropertyChanged("IsCableParameterEnabled");
      this.NotifyPropertyChanged("AreEquipmentParametersEnabled");
      this.NotifyPropertyChanged("IsAddAttachmentEnabled");
      this.NotifyPropertyChanged("IsRemoveAttachmentEnabled");
    }
  }

  public bool IsEquipmentEditable
  {
    private get => this.CableScopeStatus.IsCableInEquipment;
    set
    {
      this.NotifyPropertyChanged("AreEquipmentParametersEnabled");
      this.NotifyPropertyChanged("IsCableParameterEnabled");
      this.NotifyPropertyChanged("IsAddAttachmentEnabled");
      this.NotifyPropertyChanged("IsRemoveAttachmentEnabled");
    }
  }

  public CApCableScopeStatus CableScopeStatus { get; }

  public bool AreEquipmentParametersEnabled
  {
    get
    {
      if (!this.IsLicenseOn)
        return false;
      return !this.CableScopeStatus.IsCableInEquipment || this.CableScopeStatus.CableEquipmentModelingStatus != CApCableScopeStatus.ECableEquipmentModelingScope.NotOpenForModeling;
    }
  }

  public bool IsCableParameterEnabled
  {
    get
    {
      if (!this.IsLicenseOn)
        return false;
      return !this.IsEditMode || this.CableScopeStatus.IsCableOpenForModeling;
    }
  }

  public bool IsParametersExpanded
  {
    get => this.m_isParametersExpanded;
    set
    {
      this.m_isParametersExpanded = value;
      this.NotifyPropertyChanged(nameof (IsParametersExpanded));
    }
  }

  public bool IsAttachmentExpanded
  {
    get => this.m_isAttachmentExpanded;
    set
    {
      this.m_isAttachmentExpanded = value;
      this.NotifyPropertyChanged(nameof (IsAttachmentExpanded));
    }
  }

  public bool IsOptimizationExpanded
  {
    get => this.m_isOptimizationExpanded;
    set
    {
      this.m_isOptimizationExpanded = value;
      this.NotifyPropertyChanged(nameof (IsOptimizationExpanded));
    }
  }

  public CUiFLEXCreationMode CreationMode
  {
    get => this.m_creationMode;
    set
    {
      this.m_creationMode = value;
      this.NotifyPropertyChanged(nameof (CreationMode));
    }
  }

  public bool IsCreationParameter(string propertyName)
  {
    return propertyName == "CableName" || propertyName == "Length" || propertyName == "AttachmentDataList" || propertyName == "StartFrame" || propertyName == "EndFrame" || propertyName == "PassNearFrame" || propertyName == "OptimizationPointCloudLayer" || propertyName == "FulcrumLength" || propertyName == "Oscillation" || propertyName == "IsMinCurvatureRadiusLimited" || propertyName == "IsMaxTwistAngleLimited" || propertyName == "IsMaxContactForceLimited";
  }

  public bool IsFrameParameter(string propertyName)
  {
    return propertyName == "StartFrame" || propertyName == "EndFrame" || propertyName == "PassNearFrame" || propertyName == "AttachmentDataList" || propertyName == "StartAttachPartTo" || propertyName == "EndAttachPartTo";
  }

  public bool IsOptimizationParameter(string propertyName)
  {
    return propertyName == "IsLengthOptimizationActivated" || propertyName == "IsRadiusOptimizationActivated" || propertyName == "IsYoungsModulusOptimizationActivated";
  }

  public void AttachmentViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
  {
    if (!(e.PropertyName == "LengthFromStart"))
      return;
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void SetLengthNoEventSent(double value) => this.m_length = value;

  public void SetRadiusNoEventSent(double value) => this.m_radius = value;

  public void SetDensityNoEventSent(double value) => this.m_density = value;

  public void SeYoungsModulusNoEventSent(double value) => this.m_youngsModulus = value;

  public void SetFulcrumNoEventSent(double value) => this.m_fulcrumLength = value;

  public void SetMaxTentionNoEventSent(double value) => this.m_maxTension = value;

  public void SetMaxTwistAngleNoEventSent(double value) => this.m_maxTwistAngle = value;

  public void SetMaxContactForceNoEventSent(double value) => this.m_maxContactForce = value;

  public void SetMinCurvatureRadiusNoEventSent(double value) => this.m_minCurvatureRadius = value;

  public void AddAttachment(CApFLEXAttachment attachment)
  {
    this.AttachmentDataList.Add(attachment);
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void RemoveAttachment(CApFLEXAttachment attachment)
  {
    this.AttachmentDataList.Remove(attachment);
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void ClearAttachments()
  {
    this.AttachmentDataList.Clear();
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void ChangeStartLocatedAttachmentFrame()
  {
    if (this.StartFrame == null)
      return;
    CApFLEXAttachment capFlexAttachment = this.AttachmentDataList.Find((Predicate<CApFLEXAttachment>) (a => a.Location == CApFLEXAttachmentLocation.Start));
    if (capFlexAttachment == null || capFlexAttachment.FixedFrame == this.StartFrame)
      return;
    capFlexAttachment.FixedFrame = this.StartFrame;
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void ChangeEndLocatedAttachmentFrame()
  {
    if (this.EndFrame == null)
      return;
    CApFLEXAttachment capFlexAttachment = this.AttachmentDataList.Find((Predicate<CApFLEXAttachment>) (a => a.Location == CApFLEXAttachmentLocation.End));
    if (capFlexAttachment == null || capFlexAttachment.FixedFrame == this.EndFrame)
      return;
    capFlexAttachment.FixedFrame = this.EndFrame;
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void UpdateMaxRetractedLength()
  {
    if (!(this.AttachmentDataList.Find((Predicate<CApFLEXAttachment>) (a => a.AttachmentType == CApFLEXAttachmentType.RetractSystemType1)) is CApFLEXRetractSystemAttachmentType1 systemAttachmentType1))
      return;
    if (this.Length < this.RetractSystemCurrentMaxRetractedLength)
    {
      systemAttachmentType1.MaxRetractedLength = this.Length;
      this.NotifyPropertyChanged("AttachmentDataList");
    }
    else
    {
      if (systemAttachmentType1.MaxRetractedLength >= this.RetractSystemCurrentMaxRetractedLength)
        return;
      systemAttachmentType1.MaxRetractedLength = this.RetractSystemCurrentMaxRetractedLength;
      this.NotifyPropertyChanged("AttachmentDataList");
    }
  }

  public void UpdateEndAttachmentLengthFromStart()
  {
    CApFLEXAttachment capFlexAttachment = this.AttachmentDataList.Find((Predicate<CApFLEXAttachment>) (a => a.Location == CApFLEXAttachmentLocation.End));
    if (capFlexAttachment == null)
      return;
    capFlexAttachment.LengthFromStart = this.Length;
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public void UpdateRetractSystemCurrentMaxRetractedLength()
  {
    if (!(this.AttachmentDataList.Find((Predicate<CApFLEXAttachment>) (a => a.AttachmentType == CApFLEXAttachmentType.RetractSystemType1)) is CApFLEXRetractSystemAttachmentType1 systemAttachmentType1))
      return;
    this.RetractSystemCurrentMaxRetractedLength = systemAttachmentType1.MaxRetractedLength;
  }

  public List<CApFLEXAttachment> RawAttachmentList() => this.AttachmentDataList;

  public void InitAttachmentList() => this.AttachmentDataList = new List<CApFLEXAttachment>();

  public bool IsAttachmentListNull() => this.AttachmentDataList == null;

  public int CountAttachments() => this.AttachmentDataList.Count;

  public void SetAttachmentList(List<CApFLEXAttachment> attachments)
  {
    this.AttachmentDataList = attachments;
    this.NotifyPropertyChanged("AttachmentDataList");
  }

  public FrameSelectionType ComputeAlreadyDefinedFrameSelectionType(
    ITxLocatableObject frame,
    IEnumerable<FrameSelectionType> frameSelectionTypes)
  {
    if (frameSelectionTypes == null)
      throw new ArgumentNullException(nameof (frameSelectionTypes));
    FrameSelectionType frameSelectionType = FrameSelectionType.None;
    bool flag = false;
    IEnumerator<FrameSelectionType> enumerator = frameSelectionTypes.GetEnumerator();
    while (!flag && enumerator.MoveNext())
      flag = this.IsFrameAlreadyDefined(frame, enumerator.Current);
    if (flag)
      frameSelectionType = enumerator.Current;
    return frameSelectionType;
  }

  public bool IsFrameWithinSameScopeAsCable(ITxLocatableObject frame)
  {
    if (frame == null)
      return false;
    return !this.CableScopeStatus.IsCableInEquipment || CApCableUtility.IsObjectInsideEquipment((ITxObject) frame, this.CableScopeStatus.ParentEquipment);
  }

  private bool IsFrameAlreadyDefined(
    ITxLocatableObject frame,
    FrameSelectionType frameSelectionType)
  {
    bool flag = false;
    switch (frameSelectionType)
    {
      case FrameSelectionType.StartFrame:
        flag = this.IsFrameAlreadyDefinedAsStartFrame(frame);
        break;
      case FrameSelectionType.EndFrame:
        flag = this.IsFrameAlreadyDefinedAsEndFrame(frame);
        break;
      case FrameSelectionType.PassNearFrame:
        flag = this.IsFrameAlreadyDefinedAsPassNearFrame(frame);
        break;
      case FrameSelectionType.AttachmentFrame:
        flag = this.IsFrameAlreadyDefinedAsAttachmentFrame(frame);
        break;
    }
    return flag;
  }

  private bool IsFrameAlreadyDefinedAsStartFrame(ITxLocatableObject frame)
  {
    return frame == this.StartFrame;
  }

  private bool IsFrameAlreadyDefinedAsEndFrame(ITxLocatableObject frame) => frame == this.EndFrame;

  private bool IsFrameAlreadyDefinedAsPassNearFrame(ITxLocatableObject frame)
  {
    return frame == this.PassNearFrame;
  }

  private bool IsFrameAlreadyDefinedAsAttachmentFrame(ITxLocatableObject frame)
  {
    bool flag = false;
    List<CApFLEXAttachment>.Enumerator enumerator = this.AttachmentDataList.GetEnumerator();
    while (!flag && enumerator.MoveNext())
      flag = enumerator.Current.DoesUseFrame(frame);
    return flag;
  }

  public ITxCableOptimizationData ComputeOptimizationData() => (ITxCableOptimizationData) null;

  public bool IsLicenseOn
  {
    get => this.m_isLicenseOn;
    set
    {
      this.m_isLicenseOn = value;
      this.NotifyPropertyChanged(nameof (IsLicenseOn));
      this.NotifyPropertyChanged("AreEquipmentParametersEnabled");
      this.NotifyPropertyChanged("IsCableParameterEnabled");
      this.NotifyPropertyChanged("IsMaxTwistAngleEnabled");
      this.NotifyPropertyChanged("IsMaxContactForceEnabled");
      this.NotifyPropertyChanged("IsMinCurvatureRadiusEnabled");
    }
  }

  public bool IsBeingInitialized { get; set; }

  public bool IsCableBeingGenerated { get; set; }

  public bool HasParameterChanged() => false;

  public void NotifyPropertyAttributeChanged(string propertyName)
  {
  }

  public void NotifyCableAttributeChanged()
  {
  }

  public event PropertyChangedEventHandler PropertyChanged;

  protected void NotifyPropertyChanged(string info)
  {
    PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
    if (propertyChanged == null)
      return;
    propertyChanged((object) this, new PropertyChangedEventArgs(info));
  }

  public event PropertyChangedEventHandler PropertyWillChange;

  protected void NotifyPropertyWillChange(string info)
  {
    PropertyChangedEventHandler propertyWillChange = this.PropertyWillChange;
    if (propertyWillChange == null)
      return;
    propertyWillChange((object) this, new PropertyChangedEventArgs(info));
  }

  public event PropertyChangedEventHandler PropertyChanging;

  public event PropertyChangedEventHandler PropertyAttributeChanged;
}
